.block.block-themed.animated.fadeIn
  .block-header.bg-primary
    ul.block-options
      li
        a data-placement="left" data-toggle="tooltip" href="/register" title='没有账号？点击注册'
          | 注册 &nbsp;
          i.si.si-plus
    h3.block-title 登录系统
  .block-content.block-content-full.block-content-narrow
    / Login Title
    h1.h2.font-w600.push-30-t.push-5 系统
    small 欢迎, 请输入用户名密码登录系统.
    = simple_form_for(@user, :url => '/login', remote: true, :html=>{:id=>"login-form", :novalidate=>true, :class=>"js-validation-login form-horizontal push-30-t push-50"}) do |f|
      .form-group
        .col-xs-12
          .form-material.form-material-primary.floating
            = f.input_field :username, :required => true, class: 'form-control', label: false, wrapper_html:false
            label for="user_username" 请输入用户名
      .form-group
        .col-xs-12
          .form-material.form-material-primary.floating
            = f.input_field :password, :required => true, class: 'form-control', label: false
            label for= "user_password" 密码
      .form-group
        .col-xs-12
          label.css-input.switch.switch-sm.switch-primary
            input#login-remember-me name="remember-me" type="checkbox"
            span
            | 记住登录
          a.pull-right href='/forgot' 忘记密码
      .form-group
        .col-xs-12.col-sm-6.col-md-4
          button.btn.btn-block.btn-primary type="submit"
            i.si.si-login.pull-right
            | 登录
javascript:
  jQuery('.js-validation-login').validate({
    errorClass: 'help-block text-right animated fadeInDown',
    errorElement: 'div',
    errorPlacement: function (error, e) {
      jQuery(e).parents('.form-group > div').append(error);
    },
    highlight: function (e) {
      jQuery(e).closest('.form-group').removeClass('has-error').addClass('has-error');
      jQuery(e).closest('.help-block').remove();
    },
    success: function (e) {
      jQuery(e).closest('.form-group').removeClass('has-error');
      jQuery(e).closest('.help-block').remove();
    },
    rules: {
      'user[username]': {
        required: true
      },
      'user[password]': {
        required: true,
        minlength: 5
      }
    },
    messages: {
      'user[username]': {
        required: '请输入您的用户名'
      },
      'user[password]': {
        required: '请输入您的密码',
        minlength: '密码长度不能少于5位'
      }
    }
  });